<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/";
%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>软电话系统</title>
    <link rel="stylesheet" href="">
    <link rel="stylesheet" href="<%=basePath%>templates/style/plugins/layui/css/layui.css" media="all">
</head>
<style>
    html,body{
        height:100%;
        font-family:MicrosoftYaHei;
    }
    *{
        padding:0;
        margin:0;
    }
    a:link,a:visited{
        color:#000;
        text-decoration: none;
    }
    input{
        outline: 0;
        outline: none;
        padding-left:10px;
        box-sizing:border-box;
    }
    ol,ul {list-style:none;}
    li{list-style-type:none;}
    .shou{
        height:100%;
        width:100%;
        background:#fff;
        box-sizing:border-box;
        padding-right:2.5%;
    }
    .left{
        float:left;
        width:47.5%;
    }
    .left_t{
        width:100%;
        box-sizing:border-box;
        margin-top:17px;
        padding-left:4%;
        float:left;
    }
    .clear {
        clear: both;
    }
    .logo{
        width:104px;
        height:80px;
        float:left;
        margin-right:10.1%;
    }
    .shu{
        width:50.9%;
        height:40px;
        margin-top:19px;
        margin-right:5.1%;
        border-radius:10px;
        border:1px solid #f1f1f2;
        float:left;
    }
    input::-webkit-input-placeholder, textarea::-webkit-input-placeholder {
        font-size:16px;
        color:#a3a3a3;
        padding-left:4px;
        line-height:40px;
    }
    .dianH{
        float:left;
        margin-top:22px;
        height:32px;
        width:32px;
        cursor:pointer;
    }
    .left_b{
        width:100%;
        box-sizing:border-box;
        height:auto;
        padding-left:5.2%;
        float:left;
    }
    .boDa{
        float:left;
        width:100%;
        height:100px;
        background:#f1f1f2;
        margin-top:20px;
        position:relative;
    }
    .boDa_z{
        width:348px;
        height:19px;
        color:#555;
        float:left;
        margin:16px 0 14px 2.7%;
        text-align:center;
        position:relative;
    }
    .shouji{
        height:100%;
        width:100%;
        font-size:18px;
    }
    .boDa_zL{
        position:absolute;
        top:0;
        left:0;
        color:#555;
        font-size:18px;
    }
    .boDa_zR{
        position:absolute;
        top:0;
        right:0;
        color:#555;
        font-size:18px;
        cursor:pointer;
    }
    .boDa_iZhu{
        float:left;
        margin-left:279px;
    }
    .boDa_iZi{
        width:38px;
        height:38px;
        margin-right:15px;
        float:left;
        cursor:pointer;
    }
    .boDa_i{
        width:98px;
        height:98px;
        float:right;
        background:#fff;
        position:absolute;
        top:1px;
        right:1px;
    }
    .boDa_I{
        width:57px;
        height:57px;
        margin-top:20px;
        margin-left:22px;
        float:left;
    }
    .left_time{
        margin-top:20px;
        height:40px;
        width:100%;
        float:left;
        border:1px solid #f1f1f2;
    }
    .left_timeL{
        color:#555;
        font-size:18px;
        margin-left:3.7%;
        line-height:40px;
        float:left;
    }
    .kashi{
        width:21.1%;
        height:100%;
        border:0;
        float:left;
    }
    .left_timeC{
        color:#555;
        font-size:18px;
        line-height:40px;
        float:left;
        margin-left:2%;
    }
    .jieshu{
        width:24.6%;
        height:100%;
        border:0;
        float:left;
    }
    .left_timeR{
        margin-left:4.6%;
        float:left;
        cursor:pointer;
    }
    .fanDa{
        width:18px;
        height:18px;
        float:left;
        margin-top:12px;
    }
    .chaXunq{
        float:left;
        margin-left:11px;
        color:#555;
        font-size:18px;
        line-height:40px;
    }
    .xinxi{
        float:left;
        margin-top:21px;
        width:100%;
        height:auto;
        border:1px solid #f1f1f2;
    }
    .xinX_t{
        width:100%;
        height:40px;
        background:#f1f1f2;
    }
    .xinX_tL{
        float:left;
        color:#555;
        font-size:18px;
        width:28%;
        text-align:center;
        line-height:40px;
    }
    .xinX_tC{
        float:left;
        color:#555;
        font-size:18px;
        width:38%;
        text-align:center;
        line-height:40px;
    }
    .xinX_tR{
        float:left;
        color:#555;
        font-size:18px;
        width:34%;
        text-align:center;
        line-height:40px;
    }
    .xinX_c{
        width:100%;
        overflow: auto;
        min-height: 240px;
        max-height: 240px;
        box-sizing:border-box;
        padding-bottom:20px;
    }
    .xinX_ch{
        width:100%;
        margin-top:20px;
        height:auto;
    }
    .xinX_cL{
        float:left;
        font-size:16px;
        color:#555;
        width:28%;
        text-align:center;
    }
    .xinX_cC{
        float:left;
        font-size:16px;
        color:#555;
        width:38%;
        text-align:center;
    }
    .xinX_cR{
        float:left;
        height:16px;
        width:34%;
        box-sizing:border-box;
        padding:0 30px 0 15px;
    }
    .caoZ_o{
        float:left;
        font-size:14px;
        color:#555;
        width:60%;
        text-align:center;
        cursor:pointer;
    }
    .caoZ_s{
        float:left;
        width:40%;
        text-align:center;
        font-size:14px;
        color:#555;
        cursor:pointer;
    }
    .right{
        float:right;
        width:50%;
    }
    .right_tit{
        position:relative;
        height:auto;
        width:100%;
        margin-top:47px;
        float:right;
        margin-bottom:43px;
    }
    .right_tL{
        position:relative;
        float:left;
        margin-right:22px;
        margin-top:4px;
    }
    .zhuanT{
        color:#555;
        float:left;
        margin-right:24px;
        cursor:pointer;
    }
    .qiu_l,.qiu_b,.qiu_y,.qiu_r{
        width:12px;
        height:12px;
        border-radius:12px;
        margin-top:5px;
        margin-right:7px;
        float:left;
    }
    .qiu_l{
        background:#308D72;
    }
    .qiu_b{
        background:#555;
    }
    .qiu_y{
        background:#ffa800;
    }
    .qiu_r{
        background:#da532a;
    }
    .zhuanT_z{
        font-size:16px;
        float:left;
    }
    .right_tR{
        float:right;
        cursor:pointer;
    }
    .right_tRi{
        width:27px;
        height:27px;
        margin-right:9px;
        float:left;
    }
    .right_tui{
        color:#555;
        font-size:20px;
        line-height:27px;
        float:left;
    }
    .right_b{
        float:right;
        width:100%;
    }
    .mar_o{
        margin-right:0;
    }
    .right_bk{
        width:47.9%;
        float:left;
        border:1px solid #f1f1f2;
    }
    .zuiJ{
        margin:18px 0 14px 26px;
        color:#555;
        font-size:18px;
    }
    .chaXun{
        width:100%;
        box-sizing:border-box;
        border:1px solid #f1f1f2;
        height:40px;
        position:absolute;
        top:0;
        left:0;
    }
    .chaXun::-webkit-input-placeholder{
        color: #666;
        font-size:14px;
        color:#a3a3a3;
        padding-left:4px;
    }
    .right_bkf{
        width: 100%;
        overflow: auto;
        height:366px;
        max-height:366px;
    }
    .right_han{
        width:100%;
        box-sizing:border-box;
        padding:0 11px 0 6px;
        margin-bottom:14px;
    }
    .tou{
        width:28px;
        height:28px;
        float:left;
        margin-right:5px;
    }
    .name{
        height:28px;
        float:left;
    }
    .minzi{
        color:#555;
        font-size:16px;
        line-height:16px;
    }
    .dizhi{
        color:#555;
        font-size:12px;
        float:left;
    }
    .right_hZ{
        float:right;
        min-width:90px;
        margin-right:6px;
    }
    .left_hZ{
        float:left;
        min-width:20px;
        margin-left:5px;
    }
    .kaiFa{
        text-align:right;
        font-size:14px;
        line-height:14px;
        height:14px;
        color:#000;
        margin-top:0;
    }
    .fenji{
        font-size:12px;
        height:12px;
        color:#a3a3a3;
        float:right;
        margin-bottom:0;
    }
    .dian_tu{
        float:right;
        height:28px;
        width:28px;
        cursor:pointer;
    }
    .mar_r{
        margin-right:3.5%;
    }
    .wai{
        width:100%;
        box-sizing:border-box;
        padding:0 16px;
        height:40px;
        position:relative;
    }
    .wai_l{
        width:100%;
        height:100%;
        position:relative;
    }
    .marg_t{
        margin-top:10px;
    }
    /*颜色*/
    .disable{
        color:#bbb;
        cursor: default;
    }
    .hide{
        color:#a3a3a3;
    }
</style>
<body>
<div class="shou">
    <div class="left">
        <div class="left_t">
            <img class="logo" src="<%=basePath%>templates/style/softPhone/images/logo2.png" alt="">
            <input id="phoneNo" class="shu" type="text" placeholder="输入手机号码或者分机号">
            <img id="btnCall" class="dianH" src="<%=basePath%>templates/style/softPhone/images/dian.png" alt="">
            <div class="clear"></div>
        </div>
        <div class="left_b">
            <div class="boDa">
                <div class="boDa_z">
                    <div class="boDa_zL">来电号码： </div>
                    <div id="phoneNumber" class="shouji"></div>
                    <div class="boDa_zR"> 复制电话</div>
                </div>
                <div class="boDa_iZhu">
                    <img id="answer" class="boDa_iZi" src="<%=basePath%>templates/style/softPhone/images/huiDian.png" alt="">
                    <img id="refuse" class="boDa_iZi" src="<%=basePath%>templates/style/softPhone/images/huiDian.png" alt="">
                    <div class="clear"></div>
                </div>
                <div class="boDa_i">
                    <img id="call" class="boDa_I" src="<%=basePath%>templates/style/softPhone/images/yiS.png" alt="">
                    <div class="clear"></div>
                </div>
                <div class="clear"></div>
            </div>
            <div class="left_time">
                <div class="left_timeL">开始时间</div>
                <input name="date1" id="date1" autocomplete="off" class="layui-input kashi" type="text" style="padding-left: 20px;">
                <div class="left_timeC">结束时间</div>
                <input name="date2" id="date2" autocomplete="off" class="layui-input jieshu" type="text" style="padding-left: 20px;">
                <div class="left_timeR">
                    <img class="fanDa" src="<%=basePath%>templates/style/softPhone/images/fanDa.png" alt="">
                    <div class="chaXunq">查询</div>
                    <div class="clear"></div>
                </div>
                <div class="clear"></div>
            </div>
            <div class="xinxi">
                <div class="xinX_t">
                    <div class="xinX_tL">来电号码</div>
                    <div class="xinX_tC">时间</div>
                    <div class="xinX_tR">操作</div>
                    <div class="clear"></div>
                </div>
                <div class="xinX_c">
                </div>
                <div class="clear"></div>
            </div>
            <div class="clear"></div>
        </div>
        <div class="clear"></div>
    </div>
    <div class="right">
        <div class="right_tit">
            <div class="right_tL">
                <div class="zhuanT disable" id="btnLogin">
                    <div class="qiu_l"></div>
                    <div class="zhuanT_z">签入</div>
                </div>
                <div class="zhuanT disable" id="btnLogout">
                    <div class="qiu_b"></div>
                    <div class="zhuanT_z">签出</div>
                </div>
                <div class="zhuanT disable" id="btnReady">
                    <div class="qiu_y"></div>
                    <div class="zhuanT_z">示闲</div>
                </div>
                <div class="zhuanT mar_o disable" id="btnNotReady">
                    <div class="qiu_r"></div>
                    <div class="zhuanT_z">示忙</div>
                </div>
            </div>
            <div class="right_tR">
                <img class="right_tRi" src="<%=basePath%>templates/style/softPhone/images/tuichu.png" alt="">
                <div class="right_tui">退出</div>
                <div class="clear"></div>
            </div>
            <div class="clear"></div>
        </div>
        <div class="right_b">
            <div class="right_bk mar_r">
                <div class="zuiJ">最近联系人</div>
                <div class="wai">
                    <div class="wai_l">
                        <input id="recent" class="chaXun" type="text" placeholder="输入分机或者人名或者部门查询">
                    </div>
                </div>
                <div id="recentList" class="right_bkf">
                    <div class="marg_t"></div>
                </div>
                <div class="clear"></div>
            </div>
            <div class="right_bk">
                <div class="zuiJ">联系人</div>
                <div class="wai">
                    <div class="wai_l">
                        <input id="address" class="chaXun" type="text" placeholder="输入分机或者人名或者部门查询">
                    </div>
                </div>
                <div id="addressList" class="right_bkf">
                    <div class="marg_t"></div>
                </div>
                <div class="clear"></div>
            </div>
            <div class="clear"></div>
        </div>
        <div class="clear"></div>
    </div>
</div>
<pre style="height: 350px; overflow: scroll;display: none;" id="responses"></pre>
<textarea style="display: none" cols="20" rows="10" id="copy">用户定义的代码区域</textarea>
</body>
<script>
    if (!('placeholder' in document.createElement('input'))){
        var shuHolder=$(".shu").attr("placeholder");
        var txtHolder=$(".chaXun").attr("placeholder");
        $(".shu").val(shuHolder).addClass("hide");
        $(".chaXun").val(txtHolder).addClass("hide");
        $(".shu").focus(function(){
            if($(this).val() == shuHolder){
                $(this).val("").removeClass("hide");
            }
        }).blur(function(){
            if($(this).val().trim() === ""){
                $(this).val(shuHolder).addClass("hide");
            }
        });
        $(".chaXun").focus(function(){
            if($(this).val() == txtHolder){
                $(this).val("").removeClass("hide");
            }
        }).blur(function(){
            if($(this).val().trim() === ""){
                $(this).val(txtHolder).addClass("hide");
            }
        });
    }
</script>
<script src="<%=basePath%>templates/style/softPhone/js/jquery.min.js"></script>
<script src="<%=basePath%>templates/style/softPhone/js/interaction-callback-voice.js"></script>
<script src="<%=basePath%>templates/style/softPhone/js/interaction-event.js"></script>
<script src="<%=basePath%>templates/style/softPhone/js/softphone_voice.js"></script>
<script src="<%=basePath%>templates/style/softPhone/js/json2.js"></script>
<script src="<%=basePath%>templates/style/softPhone/js/interaction-util.js"></script>
<script src="<%=basePath%>templates/style/benstyle/js/time.js"></script>
<script src="<%=basePath%>templates/style/plugins/layui/layui.js"></script>
<script>
    $(".right_tR").click(function () {
        window.location.href='<%=basePath%>softPhone/toLogin.do';
    })
    layui.use(['laydate'], function(){
        laydate = layui.laydate;
        //日期
        laydate.render({
            elem: '#date1'
        });
        laydate.render({
            elem: '#date2'
        });
    });
    var imagePrefix="<%=basePath%>templates/style/softPhone/images/";
    var basePath = "<%=basePath%>";
    var place = "${place}";
    function getMedia(callId) {
        //alert(123);
        var prams = "";
        $.ajax( {
            url : "http://10.128.64.72:8080/api/v2/ops/contact-centers/c7a64ee2-0cbf-4f42-a811-a5fd4c65dfa8/recordings/"+callId,
            type : "GET",
            data : prams,
            dataType : "json",
            contentType : "application/json",
            headers:{"Authorization":"Basic b3BzOm9wcw=="},
            async : false,
            timeout : 1000,
            error : function(data) {
                //alert(data);
            },
            success : function(data) {
                //alert(data);
            }
        });
    }
    function copy(txt){
        $("#copy").val(txt);
        $("#copy").show();
        var Url2=document.getElementById("copy");
        Url2.select(); // 选择对象
        document.execCommand("Copy"); // 执行浏览器复制命令
        $("#copy").hide();
        layui.use('table', function () {
                layer.msg("已复制好，可贴粘。", {icon: 1, time: 2000});
        });
    }
    var flag = 1;
    $(".left_timeR").click(function () {
        getRecord(place);
    })
    $("#address").change(function(){
        getAddress();
    });
    $("#recent").change(function(){
        getRecent(place);
    });
    $(".caoZ_s").click(function() {
        if ($(this).hasClass("disable")) {
            return;
        }
        var phoneNumber = $(this).parent().prev().prev().html();
        //alert(phoneNumber);
        makeCall1(phoneNumber);
    });
    $(".dian_tu").click(function() {
        if ($(this).hasClass("disable")) {
            return;
        }
        var phoneNumber = $(this).next().children(".fenji").children("span").html();
        //alert(phoneNumber);
        makeCall1(phoneNumber);
    });
    function testLogin() {
        var loginId = "${loginId}";
        init(place, loginId, '', '["voice"]');
    }
    function dis() {
        if(flag == 2||flag == 3||flag == 4||flag == 9||flag == 13){
            $(".dian_tu").removeClass("disable");
            $(".caoZ_s").removeClass("disable");
        }
    }
    function getRecord(place) {
        log("getRecord start");
        var startTime = $("#date1").val();
        var endTime = $("#date2").val();
        $.post("<%=basePath%>callRecord/getAllJson.do", {place: place,startTime:startTime,endTime:endTime}, function (data) {
            var result = eval('('+data+')');
            var record = "";
            if (result.code == "200") {
                for(var i=0;i<result.data.length;i++){
                    var style = "";
                    if(result.data[i].status!=1){
                        style = "style=\"color:red;\"";
                    }
                    record = record + "<div class=\"xinX_ch\">\n" +
                        "                        <div class=\"xinX_cL\" "+style+">"+result.data[i].number+"</div>\n" +
                        "                        <div class=\"xinX_cC\" "+style+">"+toDateString(result.data[i].time)+"</div>\n" +
                        "                        <div class=\"xinX_cR\">\n" +
                        "                            <div class=\"caoZ_o\" onclick=\"copy('"+result.data[i].number+"')\">复制电话</div>\n" +
                        "                            <div class=\"caoZ_s disable\">回拨</div>\n" +
                        "                            <div class=\"clear\"></div>\n" +
                        "                        </div>\n" +
                        "                        <div class=\"clear\"></div>\n" +
                        "                    </div>"
                }
                //alert(record);
                $(".xinX_c").html(record);
                $(".caoZ_s").click(function() {
                    if ($(this).hasClass("disable")) {
                        return;
                    }
                    var phoneNumber = $(this).parent().prev().prev().html();
                    //alert(phoneNumber);
                    makeCall1(phoneNumber);
                });
                dis();
                // 前端修改
            } else {
                alert(data.msg);
            }
        });
    }
    function getRecent(place) {
        var search = $("#recent").val();
        $.post("<%=basePath%>recentContacts/getJson.do", {place: place,search:search}, function (data) {
            var result = eval('('+data+')');
            var recent = "<div class=\"marg_t\"></div>\n";
            if (result.code == "0") {
                for(var i=0;i<result.data.length;i++){
                    recent = recent + "<div class=\"right_han\">\n";

                    if(result.data[i].imgUrl!=null){
                        recent = recent + " <a href=\""+basePath+result.data[i].imgUrl+"\" target=\"_blank\"><img class=\"tou\" src=\""+basePath+result.data[i].imgUrl+"\" alt=\"\"></a>\n";
                    }else{
                        recent = recent + "<img class=\"tou\" src=\""+imagePrefix+"tou.png\" alt=\"\">";
                    }
                    recent = recent +"<div class=\"name\">\n" +
                        "<div class=\"left_hZ\">\n" +
                        "<p class=\"minzi\">"+result.data[i].name+"</p>\n" ;
                    if(result.data[i].area==1){
                        recent = recent + "<div class=\"dizhi\">北京市</div>\n";
                    }else if(result.data[i].area==2){
                        recent = recent + "<div class=\"dizhi\">上海市</div>\n";
                    }
                    recent = recent +
                        "                                <div class=\"clear\"></div>\n" +
                        "                            </div>\n" +
                        "                            <div class=\"clear\"></div>\n" +
                        "                        </div>\n" +
                        "<input type='hidden' value='"+result.data[i].id+"'>"+
                        "                        <img class=\"dian_tu disable\" src=\""+imagePrefix+"daDian.png\"  alt=\"\">\n" +
                        "                        <div class=\"right_hZ\">\n" +
                        "                            <p class=\"kaiFa\">"+result.data[i].group+"</p>\n" +
                        "                            <div class=\"fenji\">分机号：<span>"+result.data[i].place+"</span></div>\n" +
                        "                            <div class=\"clear\"></div>\n" +
                        "                        </div>\n" +
                        "                        <div class=\"clear\"></div>\n" +
                        "                    </div>";
                }
                //alert(recent);
                $("#recentList").html(recent);
                $(".dian_tu").unbind();
                $(".dian_tu").click(function() {
                    if ($(this).hasClass("disable")) {
                        return;
                    }
                    addRecent($(this).prev().val(),place);
                    var phoneNumber = $(this).next().children(".fenji").children("span").html();
                    //alert(phoneNumber);
                    makeCall1(phoneNumber);
                });
                dis();
            } else {
                alert(result.msg);
            }
        });
    }
    function getAddress() {
        var search = $("#address").val();
        $.post("<%=basePath%>addressList/getJson.do", {search:search}, function (data) {
            var result = eval('('+data+')');
            var address = "<div class=\"marg_t\"></div>\n";
            if (result.code == "0") {
                for(var i=0;i<result.data.length;i++){
                    address = address + "<div class=\"right_han\">\n";

                    if(result.data[i].imgUrl!=null){
                        address = address + " <a href=\""+basePath+result.data[i].imgUrl+"\" target=\"_blank\"><img class=\"tou\" src=\""+basePath+result.data[i].imgUrl+"\" alt=\"\"></a>\n";
                    }else{
                        address = address + "<img class=\"tou\" src=\""+imagePrefix+"tou.png\" alt=\"\">";
                    }
                    address = address +"<div class=\"name\">\n" +
                        "<div class=\"left_hZ\">\n" +
                        "<p class=\"minzi\">"+result.data[i].name+"</p>\n" ;
                    if(result.data[i].area==1){
                        address = address + "<div class=\"dizhi\">北京市</div>\n";
                    }else if(result.data[i].area==2){
                        address = address + "<div class=\"dizhi\">上海市</div>\n";
                    }
                    address = address +
                        "                                <div class=\"clear\"></div>\n" +
                        "                            </div>\n" +
                        "                            <div class=\"clear\"></div>\n" +
                        "                        </div>\n" +
                        "<input type='hidden' value='"+result.data[i].id+"'>"+
                        "                        <img class=\"dian_tu disable\" src=\""+imagePrefix+"daDian.png\"  alt=\"\">\n" +
                        "                        <div class=\"right_hZ\">\n" +
                        "                            <p class=\"kaiFa\">"+result.data[i].group+"</p>\n" +
                        "                            <div class=\"fenji\">分机号：<span>"+result.data[i].place+"</span></div>\n" +
                        "                            <div class=\"clear\"></div>\n" +
                        "                        </div>\n" +
                        "                        <div class=\"clear\"></div>\n" +
                        "                    </div>";
                }
                //alert(address);
                $("#addressList").html(address);
                $(".dian_tu").unbind();
                $(".dian_tu").click(function() {
                    if ($(this).hasClass("disable")) {
                        return;
                    }
                    addRecent($(this).prev().val(),place);
                    var phoneNumber = $(this).next().children(".fenji").children("span").html();
                    //alert(phoneNumber);
                    makeCall1(phoneNumber);
                });
                dis();
            } else {
                alert(result.msg);
            }
        });
    }
    function addRecent(id,place) {
        $.post("<%=basePath%>recentContacts/add.do", {id:id,place:place}, function (data) {
            var result = eval('('+data+')');
            if (result.code == "200") {
                getRecent(place);
            } else {
                //alert(result.msg);
            }
        });
    }
    function record(result) {
        log("record start");
        var number = result.phoneNumber;
        var callId = result.call.callUuid;
        var place = "";
        var userData = result.call.userData;
        if(userData!=null){
            place = userData.RTargetPlaceSelected;
        }else{
            place = result.call.dnis;
        }
        $.ajax( {
            url : "<%=basePath%>callRecord/add.do",
            type : "POST",
            data : {number:number,callId:callId,place:place,type:0},
            dataType : "String",
            async : false,
            timeout : 1000,
            error : function() {
            },
            success : function(data) {
                log(data);
            }
        })
        getRecord(place);
        getRecent(place);
        log("record end");
    }
    function record2(result) {
        log("record start");
        var number = result.phoneNumber;
        var callId = result.call.callUuid;
        var place = "";
        var userData = result.call.userData;
        if(userData!=null){
            place = userData.RTargetPlaceSelected;
        }else{
            place = result.call.dnis;
        }
        $.ajax( {
            url : "<%=basePath%>callRecord/add.do",
            type : "POST",
            data : {number:number,callId:callId,place:place,type:1},
            dataType : "String",
            async : false,
            timeout : 1000,
            error : function() {
            },
            success : function(data) {
                log(data);
            }
        })
        getRecord(place);
        getRecent(place);
        log("record end");
    }
    function answer(result) {
        log("record start");
        var callId = result.call.callUuid;
        var place = "";
        var userData = result.call.userData;
        if(userData!=null){
            place = userData.RTargetPlaceSelected;
        }else{
            place = result.call.dnis;
        }
        $.ajax( {
            url : "<%=basePath%>callRecord/answer.do",
            type : "POST",
            data : {callId:callId},
            dataType : "String",
            async : false,
            timeout : 1000,
            error : function() {
            },
            success : function(data) {
                log(data);
            }
        })
        getRecord(place);
        getRecent(place);
        log("record end");
    }
    testLogin();
    getRecord("${place}");
    getRecent("${place}");
    getAddress();
</script>
</html>